package model.teacher;

import java.io.Serializable;
import java.util.ArrayList;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import model.Link;

@XmlRootElement(name = "teacher")
public class Teacher extends Link implements Serializable
{
	private static final long serialVersionUID = 7279050628531098897L;

	private static int i = 0;
	
	@XmlAttribute
	private String id = "";
	
	@XmlAttribute
	private String name;
	
	@XmlAttribute
	private String unit;
	
	@XmlElement(name = "day")
	public ArrayList<Day> days = new ArrayList<Day>();
	
	public Teacher() {}
	
	public Teacher(String name, String unit)
	{
		i++;
		this.id = i + "";
		this.name = name;
		this.unit = unit;
	}
	
	public Day createDay(String name)
	{
		Day day = new Day(name);
		days.add(day);
		return day;
	}
	
	public String toString()
	{
		String out = "";
		for (int i = 0; i < days.size(); i++)
		{
			out += days.get(i) + "\n";
		}
		return "Teacher -> Name: " + name + " | Unit: " + unit + "\n" + out;
	}

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public String getUnit()
	{
		return unit;
	}

	public ArrayList<Day> getDays()
	{
		return days;
	}
}
